﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Student
{
    class Course
    {
        Dictionary<int, Student> studentsByFaculty;

        public Course()
        {
            this.studentsByFaculty = new Dictionary<int, Student>();
        }

        public Dictionary<int, Student> StudentsByFaculty
        {
            get
            {
                return studentsByFaculty;
            }
            set
            {
                studentsByFaculty = value;
            }
        }

        public void Join(Student newStudent)
        {
            if (this.studentsByFaculty.Count+1 > 30)
            {
                throw new IndexOutOfRangeException("Students must be than 30.");
            }
            this.studentsByFaculty.Add(newStudent.FacultyNumber, newStudent);
        }

        public void Leave(Student newStudent)
        {
            if (this.studentsByFaculty.Remove(newStudent.FacultyNumber) == false)
            {
                throw new ArgumentOutOfRangeException("The student does not exist.");
            }
        }
    }
}
